//test
import Vue from 'vue';

export const getCount = state => {
    return state.count
}

export const getToken = state => {

    let storage = window.sessionStorage;
    if ((storage.token || '') != '') {
        state.token = storage.token
        return state.token;
    } else {
        storage.token= state.token
        return state.token;
    }
}

export const getMerchantName = state => {
    
        let storage = window.sessionStorage;
        if ((storage.merchantName || '') != '') {
            state.merchantName = storage.merchantName
            return state.merchantName;
        } else {
            storage.merchantName= state.merchantName
            return state.merchantName;
        }
    }
export const getMerchantIcon = state => {
    
        let storage = window.sessionStorage;
        if ((storage.merchantIcon || '') != '') {
            state.merchantIcon = storage.merchantIcon
            return state.merchantIcon;
        } else {
            storage.merchantIcon= state.merchantIcon
            return state.merchantIcon;
        }
    }

export const getRoleTpye = state => {
    
        let storage = window.localStorage;
        if ((storage.getRoleTpye || '') != '') {
            state.roleTpye = storage.getRoleTpye
            return state.roleTpye;
        } else {
            storage.getRoleTpye= state.roleTpye
            return state.roleTpye;
        }
    }
export const getMerchantId = state => {
    
        let storage = window.sessionStorage;
        if ((storage.merchantId || '') != '') {
            state.merchantId = storage.merchantId
            return state.merchantId;
        } else {
            storage.merchantId= state.merchantId
            return state.merchantId;
        }
    }

    export const getModel = state => {
        
            let storage = window.sessionStorage;
            if ((storage.memberAudit || '') != ''&&(storage.basicMall || '') != ''&&(storage.seniorMall || '') != '' &&(storage.merchantUserId || '') != ''  && (storage.componentSearch || '') != ''&& (storage.maintenanceUpload || '') != '') {
                let model = {
                    memberAudit:storage.memberAudit,//注册审核
                    basicMall:storage.basicMall,//商城
                    seniorMall:storage.seniorMall,//客户等级
                    showModelRela:storage.showModelRela,//商品适应车型
                    merchantUserId:storage.merchantUserId,
                    componentSearch:storage.componentSearch,
                    maintenanceUpload:storage.maintenanceUpload
                    }
                state.model = model
                return state.model;
            } else {
                return state.model;
            }
        }

